
library(testthat)
library(blma)
library(tictoc)
library(parallel)

cores <- detectCores()

test_that('eyeData produces correct results zellner_siow_gauss_laguerre', {
	set.seed(2019)
	eyeData <- get_eyeData()
    vy <- eyeData$vy
    mX <- eyeData$mX
    p <- ncol(mX)
    tic('eyeData produces correct results zellner_siow_gauss_laguerre')
    result <- sampler(100000, vy, mX, prior='zellner_siow_gauss_laguerre', modelprior='beta-binomial', modelpriorvec=c(1, p), cores=cores)
    toc()
    expect_equal(result$vinclusion_prob,
c(
0.003350000000000000,0.005180000000000000,0.001600000000000000,
0.001850000000000000,0.002800000000000000,0.003660000000000000,
0.001520000000000000,0.003890000000000000,0.001760000000000000,
0.002190000000000000,0.060069999999999998,0.003320000000000000,
0.002980000000000000,0.001970000000000000,0.001600000000000000,
0.003270000000000000,0.001410000000000000,0.001710000000000000,
0.002590000000000000,0.001480000000000000,0.001600000000000000,
0.001700000000000000,0.002030000000000000,0.001460000000000000,
0.001420000000000000,0.003670000000000000,0.001590000000000000,
0.010070000000000001,0.001290000000000000,0.003780000000000000,
0.004200000000000000,0.001410000000000000,0.002580000000000000,
0.001870000000000000,0.001830000000000000,0.006130000000000000,
0.001630000000000000,0.002660000000000000,0.001640000000000000,
0.001640000000000000,0.001670000000000000,0.040520000000000000,
0.001790000000000000,0.001680000000000000,0.001460000000000000,
0.002030000000000000,0.001670000000000000,0.001590000000000000,
0.002380000000000000,0.005990000000000000,0.001710000000000000,
0.003880000000000000,0.001650000000000000,0.010510000000000000,
0.010019999999999999,0.001290000000000000,0.001870000000000000,
0.002310000000000000,0.002710000000000000,0.010220000000000000,
0.001470000000000000,0.028989999999999998,0.002160000000000000,
0.002400000000000000,0.002110000000000000,0.007760000000000000,
0.001810000000000000,0.001650000000000000,0.001410000000000000,
0.002090000000000000,0.014579999999999999,0.001450000000000000,
0.001670000000000000,0.001960000000000000,0.001750000000000000,
0.018910000000000000,0.001880000000000000,0.002900000000000000,
0.001510000000000000,0.001870000000000000,0.001460000000000000,
0.001530000000000000,0.001670000000000000,0.001810000000000000,
0.004510000000000000,0.001960000000000000,0.175520000000000009,
0.001980000000000000,0.002540000000000000,0.021819999999999999,
0.001440000000000000,0.005360000000000000,0.002840000000000000,
0.001280000000000000,0.001740000000000000,0.004340000000000000,
0.001910000000000000,0.001460000000000000,0.014409999999999999,
0.002040000000000000,0.002330000000000000,0.009660000000000000,
0.001270000000000000,0.003350000000000000,0.001610000000000000,
0.001840000000000000,0.003430000000000000,0.003990000000000000,
0.024620000000000000,0.008540000000000001,0.003920000000000000,
0.015590000000000000,0.003960000000000000,0.002030000000000000,
0.001890000000000000,0.001560000000000000,0.003530000000000000,
0.001510000000000000,0.001720000000000000,0.001580000000000000,
0.001800000000000000,0.001460000000000000,0.007050000000000000,
0.002960000000000000,0.007770000000000000,0.001580000000000000,
0.010030000000000001,0.001790000000000000,0.001720000000000000,
0.001620000000000000,0.001740000000000000,0.008650000000000000,
0.001400000000000000,0.008290000000000000,0.004990000000000000,
0.024840000000000001,0.002510000000000000,0.001490000000000000,
0.001880000000000000,0.010489999999999999,0.011469999999999999,
0.001610000000000000,0.001910000000000000,0.001570000000000000,
0.001730000000000000,0.007120000000000000,0.007910000000000000,
0.003710000000000000,0.001410000000000000,0.001630000000000000,
0.002810000000000000,0.002540000000000000,0.950659999999999950,
0.005710000000000000,0.032280000000000003,0.001640000000000000,
0.008340000000000000,0.007860000000000001,0.014360000000000000,
0.002040000000000000,0.005800000000000000,0.006230000000000000,
0.002820000000000000,0.016480000000000002,0.002160000000000000,
0.002030000000000000,0.001360000000000000,0.002230000000000000,
0.001420000000000000,0.003860000000000000,0.001660000000000000,
0.024809999999999999,0.003730000000000000,0.002190000000000000,
0.003630000000000000,0.002480000000000000,0.006720000000000000,
0.001470000000000000,0.002450000000000000,0.757489999999999997,
0.057410000000000003,0.018710000000000001,0.007320000000000000,
0.004400000000000000,0.742229999999999945,0.001940000000000000,
0.044960000000000000,0.010149999999999999,0.003470000000000000,
0.003170000000000000,0.001770000000000000,0.001610000000000000,
0.001370000000000000,0.001600000000000000,0.001350000000000000,
0.003880000000000000,0.001790000000000000,0.002410000000000000,
0.003850000000000000,0.053920000000000003
)
, tolerance = 1e-8)
})